﻿using System;
using System.Web;
using System.Web.Optimization;

namespace Cofe.Web
{
    public class BundleConfig
    {
        // For more information on Bundling, visit http://go.microsoft.com/fwlink/?LinkId=254725
        public static void RegisterBundles(BundleCollection bundles)
        {
            //bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
            //            "~/Scripts/jquery-{version}.js",
            //            "~/Scripts/jquery.tmpl.js")
            //            );
            //bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
            //            "~/Scripts/jquery-ui-{version}.js"));


            bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                       "~/Scripts/jquery-1.9.1.js",
                       //"~/Scripts/jquery.tmpl.js",
                       "~/Scripts/jsrender.js",
                       "~/Scripts/jquery.arrayUtilities.js",
                       "~/Scripts/jquery.csv-0.71.js")
                       );            

            bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
                        "~/Scripts/jquery-ui-1.10.3.custom.js",
                        "~/Scripts/jquery.watermarkinput.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryfile").Include(
                      "~/Scripts/jquery.blockUI.js",
                      "~/Scripts/jquery.form.js",
                      "~/Scripts/jquery.MetaData.js",
                      "~/Scripts/jquery.MultiFile.js",
                      "~/Scripts/jquery.MultiFile.pack.js",
                      "~/Scripts/jquery.validate.js"));

            bundles.Add(new ScriptBundle("~/bundles/jquerymobile").Include(
                        "~/Scripts/jquery.mobile-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
                        "~/Scripts/jquery.unobtrusive*",
                        "~/Scripts/jquery.validate*"));

            bundles.Add(new ScriptBundle("~/bundles/waypoint").Include(
                        "~/Scripts/waypoints.js",
                        "~/Scripts/waypoints-infinite.js"));            

            bundles.Add(new ScriptBundle("~/bundles/spine").Include(
                            "~/Scripts/spine-1.1.0/spine.js",
                            "~/Scripts/spine-1.1.0/local.js",
                            "~/Scripts/spine-1.1.0/route.js"));

            bundles.Add(new ScriptBundle("~/bundles/pnotify").Include(
                            "~/Scripts/jquery.pnotify.js"));

            bundles.Add(new ScriptBundle("~/bundles/qunit").Include(
                        "~/Scripts/qunit-{version}.js"));

            bundles.Add(new ScriptBundle("~/bundles/log4javascript").Include(
                        "~/Scripts/log4javascript-1.4.6/log4javascript.js", 
                        "~/Scripts/log4javascript_dummyLogger.js"));

            // Use the development version of Modernizr to develop with and learn from. Then, when you're
            // ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
            bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
                        "~/Scripts/modernizr-*"));

            bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
            bundles.Add(new StyleBundle("~/Content/mobilecss").Include("~/Content/site.Mobile.css"));
            bundles.Add(new StyleBundle("~/Content/qunit/css").Include(
                       "~/Content/themes/tests/qunit-1.10.0.css"));

            //bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
            //            "~/Content/themes/base/jquery.ui.core.css",
            //            "~/Content/themes/base/jquery.ui.resizable.css",
            //            "~/Content/themes/base/jquery.ui.selectable.css",
            //            "~/Content/themes/base/jquery.ui.accordion.css",
            //            "~/Content/themes/base/jquery.ui.autocomplete.css",
            //            "~/Content/themes/base/jquery.ui.button.css",
            //            "~/Content/themes/base/jquery.ui.dialog.css",
            //            "~/Content/themes/base/jquery.ui.slider.css",
            //            "~/Content/themes/base/jquery.ui.tabs.css",
            //            "~/Content/themes/base/jquery.ui.datepicker.css",
            //            "~/Content/themes/base/jquery.ui.progressbar.css",
            //            "~/Content/themes/base/jquery.ui.theme.css"));

            bundles.Add(new StyleBundle("~/Content/themes/ui-lightness/css").Include(
                        "~/Content/themes/ui-lightness/jquery-ui-1.10.3.custom.css"));

            Action<string> addJQueryStyle = (style) =>
                {
                    string bundleName = String.Format("~/Content/themes/{0}/css", style);
                    string[] bundlePath =
                        new string[]
                        {
                            String.Format("~/Content/themes/{0}/jquery-ui-1.10.3.custom.css", style),
                            String.Format("~/Content/themes/{0}/jquery.pnotify.css", style),
                            String.Format("~/Content/themes/base/jquery.pnotify.default.css", style),
                            String.Format("~/Content/themes/base/jquery.pnotify.default.icons.css", style)
                        };                    
                    bundles.Add(new StyleBundle(bundleName).Include(bundlePath));                 
                };

            addJQueryStyle("flick");
            addJQueryStyle("smoothness");
            addJQueryStyle("pepper-grinder");
            addJQueryStyle("ui-lightness");


            bundles.Add(new StyleBundle("~/Content/themes/base/mobilecss").Include(
            "~/Content/themes/base/jquery.mobile-1.3.1.css"));

            

        }
    }
}